#include<vector>
#include<iostream>
#include<algorithm>

using namespace std;


//C语言的接口型oj实现杨辉三角
/**
 * Return an array of arrays of size *returnSize.
 * The sizes of the arrays are returned as *returnColumnSizes array.
 * Note: Both returned array and *columnSizes array must be malloced, assume caller calls free().
 */
int** generate(int numRows, int* returnSize, int** returnColumnSizes) 
{
    int** ret = (int**) malloc (sizeof(int*) * numRows);
    *returnSize = numRows;
    *returnColumnSizes = malloc(sizeof(int) * numRows);
    for(int i = 0; i < numRows; i++)
    {
        ret[i] = malloc(sizeof(int) * (i+1));
        (*returnColumnSizes)[i] = i + 1;
        ret[i][0] = ret[i][i] = 1;
        for(int j = 1; j < i; j++)
        {
            ret[i][j] = ret[i-1][j] + ret[i-1][j-1];
        }
    }

    return ret;
}

void test_01()
{
    int arr[] = {2,1,5,3,4,6};

    vector<int> v1(arr, arr + 6);
    for(auto e : v1)
    {
        cout << e << " ";
    }
    cout << endl;

    sort(v1.begin(), v1.end());
    sort(v1.begin(), v1.end(), greater<int>()); 
    for(auto e : v1)
    {
        cout << e << " ";
    }
    cout << endl;


}

int main()
{
    test_01();   
    return 0;
}
